import {
  createSelector,
  createFeatureSelector,
  ActionReducerMap
} from "@ngrx/store";
import * as fromAssets from "./assets.reducer";
import { AssetsActions } from "../actions";
import * as fromRoot from "@/reducers";

export interface AssetsState {
  assets: fromAssets.State;
}

export interface State {
  assets: AssetsState;
}

export const reducers: ActionReducerMap<
  AssetsState,
  AssetsActions.AssetsActionsUnion
> = {
  assets: fromAssets.reducer
};

// export const getAssetsState = createFeatureSelector<State, AssetsState>(
//   "assets"
// );

// export const assetsLists = createSelector(
//   getAssetsState,
//   (state: any) => {
//     return state.assets.selectAssetsResponse.data;
//   }
// );

// export const assetsMap = createSelector(
//   getAssetsState,
//   (state: any) => {
//     let ret = null;
//     if (!!state.assets.selectAssetsResponse.data) {
//       ret = {};
//       state.assets.selectAssetsResponse.data.forEach(d => {
//         ret[d.coin] = {
//           ...d
//         };
//       });
//     }
//     return ret;
//   }
// );

// export const coinConfigLists = createSelector(
//   getAssetsState,
//   (state: any) => {
//     const ret = [];
//     return ret;
//   }
// );

// export const assets = createSelector(
//   getAssetsState,
//   (state: any) => state.assets.findAssetsResponse.data
// );

// export const depositHistoryLists = createSelector(
//   getAssetsState,
//   (state: any) => state.assets.selectDepositHistoryResponse.data
// );

// export const withdrawHistoryLists = createSelector(
//   getAssetsState,
//   (state: any) => state.assets.selectWithdrawHistoryResponse.data
// );

// export const withdrawAddressLists = createSelector(
//   getAssetsState,
//   (state: any) => state.assets.selectWithdrawAddressResponse.data
// );

// export const depositAddress = createSelector(
//   getAssetsState,
//   (state: any) => state.assets.findDepositAddressResponse.data
// );
